import { reactive, ref } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', () => {
    const user = reactive({
        id: '',
        username: '',
        img: '',
        signature: '',
        detail_id: '',

    })
    const setUser = (data) => {
        user.id = data.userId;
        user.username = data.name;
        user.img = data.img;
        user.signature = data.signature;
        user.detail_id = data.id;
    }
    const setSignature = (data) => {
        user.signature = data;
    }
    const setUsername = (data) => {
        user.username = data;
    }
    const token = ref('');
    const setToken = (data) => {

    }
    return { user, setUser, setSignature, setUsername };
}, {
    persist: true
})